[Embedded Programming]-

Tasks for the week:

-Read a microcontroller data sheet.

-Program your board to do something, with as many different programming languages and programming environments as possible.

  • Data sheet
  • The datasheet is available online from the Atmel site. There are many versions of the document, it's in 286 pages. There is also a 26-page summary datasheet. The summary document contains the main features of the MCU, the putout diagram, architecture overview, register summary, assembly instruction set and packaging information, but doesn't describe the microcontroller features in detail. To really understand the microcontroller, you would need to read the full data sheet.

    responsive

    -I am first time using Programming so i am learning basic Programming and all the things.

    Task:01:

    This week the first task was to read the micro controller data sheet. So I started with it. Since, I am new to electronics, I didn't understand much when I started then my fellow fab-acdamey page helped me understand it.

    The first page helped me understand the features of the ATTiny. Next page is the Pin diagram. This page was very helpful. It helped me understand as to what pin of the ATTiny links to what. Next all the pins have been described in detail. It helps for a new person like me to understand the micro controller better.

    In the overview section there is an introduction to the architecture and to the main features of the microcontroller.

    responsive

    For example number and type of:

    -input and output lines,

    -registers,

    -timers/counters,

    -PWM (pulse with modulation),

    -interrupts,

    -ADC (analog to digital converter),

    -Analog Comparator...

    pin configuration attiny44-

    responsive responsive

    Task:02

    Programming the board:

    Arduino IDE:

    "The Arduino IDE supports the languages C and C++ using special rules of code structuring. The Arduino IDE supplies a software library from the Wiring project, which provides many common input and output procedures. User-written code only requires two basic functions, for starting the sketch and the main program loop, that are compiled and linked with a program stub main into an executable cyclic executive program with the GNU tool chain, also included with the IDE distribution. The Arduino IDE employs the program avrdude to convert the executable code into a text file in hexadecimal encoding that is loaded into the Arduino board by a loader program in the board's firmware."

    Blinking led-Arduino IDE

    responsive

    1-Hardwear stetup

    Materials and Tools

    I need an in-system programmer (ISP) use the FabISP I made in class.

    Hello board

    responsive

    2-Programing

    I have Download the Arduino IDE Software

    ATtiny 44A Microcontroller Pin-Outs

    The pinouts on the microcontroller are not the same numbers in the Arduino code. The microcontroller pin number is listed on the microcontroller body below. The corresponding Arduino pin is listed on the outside - to the right or left.

    responsive

    I have Download the ATtiny Board (Board Manager)

    Connecting the ATtiny

    I need to provide power to the ATtiny and connect it to your programmer (FabISP). That is, connecting MISO, MOSI, SCK, RESET, VCC, and GND of the programmer to the corresponding pins on the Attiny.

    Connect the programmer to the ISP header on the LED + Button board

    I will also need to power the LED + Button board with an FTDI cable in case your FabIsp doesn't supply current.

    Configuring the Attiny to run at 20 MHz

    Avrdude needs sudo access in order to send your Arduino code to the board. You will need to run avrdude as sudo.

    Blinking led-Avrdude&terminal

    make file

    Programming: ATtiny44 Hello Board

    A makefile allows the user to automate the process of compiling C-code for an AVR processor and to subsequently send the compiled binary file (.hex) to a programmer to upload it to the device. A good introduction to makefiles and the make utility can be found in the Fabacademy tutorial archive. The URL for the makefile tutorial is

  • Make file
  • For a simple example of the work flow involved in programming the ATtiny44 hello board using avr-gcc and avrdude, I decided to write a program to blink the on board LED. The source code for my program is given below:

    Program operation begins at the function main(). The DDRB |= 1 >PB2 statement sets PB2 to an output port. The PORTB |= ~(1PB2) statement sends a logic 0 to Pin PB2 and turns off the LED on the Hello Board. These 2 statements are run once when the program first begins execution.

    The instructions for compiling the C source code is found in my makefile. I have reproduced the contents of the makefile below for convenience:

    I have captured a sample compile/program cycle to show how avr-gcc works in tandem with avrdude, controlled by the makefile, to flash the attiny44 with my blink program. To start, copy the hello.ftdi.44.blink.c.make file to Makefile. Then run the make utility. This will generate the hello.ftdi.44.blink.c.hex file. To upload the .hex file to your ATtiny44 Hello board, simply call make with the correct programmer option, for example, make program-usbtiny

    With both the C code and makefile in my root directory, I compiled the code:

  • Make file
  • responsive

    then setting the fuses, to set the clock to 20MHz using the external crystal:

    make -f hello.ftdi.44.echo.c.make program-usbtiny-fuses

    responsive

    and programmed the microcontroller:

    make -f hello.ftdi.44.echo.c.make program-usbtiny

    responsive

    Programming an AVR in C: LED Blink

    responsive

    I spent a few hours trying to get term.py installed with pip, so I could test if the board was working as expected. In the end, I opened up the Arduino IDE, selected term.py com 6 115200 as the serial port and opened up the Serial Monitor with a 115200 baudrate.

    Click on the links below to download the C sourcecode and the makefile:

  • hello.ftdi.44.blink.make
  • hello.ftdi.44.blink.c.make
  • Power the FabISP Board

    The board needs power:

    Make sure that the mini USB connector for the FabISP you are trying to program is plugged into your computer.

    AND that a separate pogramer is plugged in to the 6-pin programming header. (this could be another working FabISP or the ATAVRISP2, a USBtiny, an AVR Dragon, etc.)

    Programer

    Here I Connect the Hello board with PC vai FTDI cable and also connect with FABISP with ISP header PIN, FABISP directly connect with USB with PC.

    responsive

    Shown with a USBtiny programmer

    Green Light: means that the header is soldered correctly, the board is getting power

    responsive

    Group Assignment -

    For this week we have to understand the Architecture of the board. We had decided to explore the architecture, configuration and coding it through python.

    responsive

  • Specification:
  • CHIP- Broadcom BCM2835 SoC
  • Core Architecture- ARM11
  • CPU- 700 MHz Low Power ARM1176JZFS
  • GPU- Dual Core VideoCore IV® Multimedia Co-Processor
  • Memory- 512MB SDRAM
  • Operating system- Boots from Micro SD card, running a version of the Linux operating system
  • Dimension- 85 x 56 x 17mm
  • Power- Micro USB socket 5V, 2A

  • Coding for LED blinking program:-


    For this we had connected the raspberry pi b+ with keyboards and powered it up, to boot through it. The OS that we had installed was Raspbian , having a pretty simple user interface


    responsive

    We wrote a test program for blinking the LED in local text editor in Raspbian. The code is as shown below:


    responsive

    We connected our LED to GPIO pin of the board on the bread board. The connection are as follows:


    responsive

    Then check the pin in a code which we connected on the board and write the correct pin number in a code..

    Learning Outcomes-

    In this assignment I learned about Embedded Programming which is really best for experiment the Hello board Programming, Good experience in programming work.

    To download my files click here